<?php
namespace app\serverfund\model;

use \app\manage\model\BaseModel;

/**
 * @author:      李颖
 * @DateTime:    2017-07-03 15:03:13
 * @Description: 数字币冻结日志  
 */
class CurrencyFreezeLog extends BaseModel
{
    protected $name = 'currency_freeze_log';
    protected $connection = 'db_config_fund';
    protected $dateFormat = 'Y-m-d H:i:s';
    protected $append = ['status_text','type_text','freeze_status_text'];
    protected $typeText = ['goods'=>'商品', 'certificate'=>'证书', 'order'=>'订单', 'system'=>'系统'];
    protected $freezeStatusText = ['0'=>'未全解冻', '1'=>'已全解冻'];

    public function getTypeTextAttr($value, $data)
    {
        return $this->typeText[$data['type']];
    }

    public function getFreezeStatusTextAttr($value, $data)
    {
        return $this->freezeStatusText[$data['freeze_status']];
    }

    //model里不进行set  因为接收后转为了字符串进行了验证 故传值为字符串的形式
    /*public function setUserInfoAttr($value)
    {
        return json_encode($value);
    }*/
   
    public function getUserInfoAttr($value)
    {
        return json_decode($value, true);
    }

    /*public function setOppositeInfoAttr($value)
    {
        return json_encode($value);
    }*/
  
    public function getOppositeInfoAttr($value)
    {
        return json_decode($value, true);
    }

    
}
